

package com.gxks.lhs.controller.user;

import com.gxks.lhs.constants.R;
import com.gxks.lhs.entity.Area;
import com.gxks.lhs.service.IAreaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/restful-api/area")
@Tag(name = "省市区接口")
public class AreaController {

    @Autowired
    private IAreaService areaService;

    /**
     * 分页获取
     */
    @GetMapping("/listByPid")
    @Operation(summary = "获取省市区信息", description = "根据省市区的pid获取地址信息")
    @Parameter(name = "pid", description = "省市区的pid(pid为0获取所有省份)", required = true)
    public R listByPid(Long pid) {
        List<Area> list = areaService.listByPid(pid);
        return R.success(list);
    }

}
